<?php

namespace App\Model\DesignPattern\Creational\Structural\Proxy;

class SecuredDoor  
{
    protected $door;

    public function __construct(Door $door)
    {
        $this->door = $door;
    }

    public function open($password = '')
    {
        if($this->auth($password)) {
            return $this->door->open();
        }else {
            return '你是谁';
        }
    }

    public function auth($password)
    {
        return $password === '123456';
    }
}
